\(\int \sinh ^2(c+d x) (a+b \tanh ^3(c+d x)) \, dx\) [51]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 100 \[ \int \sinh ^2(c+d x) \left (a+b \tanh ^3(c+d x)\right ) \, dx=\frac {(a+4 b) \log (1-\tanh (c+d x))}{4 d}-\frac {(a-4 b) \log (1+\tanh (c+d x))}{4 d}+\frac {a \tanh (c+d x)}{2 d}+\frac {b \tanh ^2(c+d x)}{2 d}+\frac {\sinh ^2(c+d x) (b+a \tanh (c+d x))}{2 d} \]

[Out]

1/4*(a+4*b)*ln(1-tanh(d*x+c))/d-1/4*(a-4*b)*ln(1+tanh(d*x+c))/d+1/2*a*tanh(d*x+c)/d+1/2*b*tanh(d*x+c)^2/d+1/2*
sinh(d*x+c)^2*(b+a*tanh(d*x+c))/d

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {3744, 1818, 1816, 647, 31} \[ \int \sinh ^2(c+d x) \left (a+b \tanh ^3(c+d x)\right ) \, dx=\frac {(a+4 b) \log (1-\tanh (c+d x))}{4 d}-\frac {(a-4 b) \log (\tanh (c+d x)+1)}{4 d}+\frac {\sinh ^2(c+d x) (a \tanh (c+d x)+b)}{2 d}+\frac {a \tanh (c+d x)}{2 d}+\frac {b \tanh ^2(c+d x)}{2 d} \]

[In]

Int[Sinh[c + d*x]^2*(a + b*Tanh[c + d*x]^3),x]

[Out]

((a + 4*b)*Log[1 - Tanh[c + d*x]])/(4*d) - ((a - 4*b)*Log[1 + Tanh[c + d*x]])/(4*d) + (a*Tanh[c + d*x])/(2*d)
+ (b*Tanh[c + d*x]^2)/(2*d) + (Sinh[c + d*x]^2*(b + a*Tanh[c + d*x]))/(2*d)

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 647

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> With[{q = Rt[(-a)*c, 2]}, Dist[e/2 + c*(d/(2*q)),
Int[1/(-q + c*x), x], x] + Dist[e/2 - c*(d/(2*q)), Int[1/(q + c*x), x], x]] /; FreeQ[{a, c, d, e}, x] && NiceS
qrtQ[(-a)*c]

Rule 1816

Int[(Pq_)*((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*Pq*(a + b*x
^2)^p, x], x] /; FreeQ[{a, b, c, m}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rule 1818

Int[(Pq_)*((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = PolynomialQuotient[Pq, a + b*x
^2, x], f = Coeff[PolynomialRemainder[Pq, a + b*x^2, x], x, 0], g = Coeff[PolynomialRemainder[Pq, a + b*x^2, x
], x, 1]}, Simp[(c*x)^m*(a + b*x^2)^(p + 1)*((a*g - b*f*x)/(2*a*b*(p + 1))), x] + Dist[c/(2*a*b*(p + 1)), Int[
(c*x)^(m - 1)*(a + b*x^2)^(p + 1)*ExpandToSum[2*a*b*(p + 1)*x*Q - a*g*m + b*f*(m + 2*p + 3)*x, x], x], x]] /;
FreeQ[{a, b, c}, x] && PolyQ[Pq, x] && LtQ[p, -1] && GtQ[m, 0]

Rule 3744

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[c*(ff^(m + 1)/f), Subst[Int[x^m*((a + b*(ff*x)^n)^p/(c^2 + ff^2*x^2)
^(m/2 + 1)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {x^2 \left (a+b x^3\right )}{\left (1-x^2\right )^2} \, dx,x,\tanh (c+d x)\right )}{d} \\ & = \frac {\sinh ^2(c+d x) (b+a \tanh (c+d x))}{2 d}+\frac {\text {Subst}\left (\int \frac {x \left (-2 b-a x-2 b x^2\right )}{1-x^2} \, dx,x,\tanh (c+d x)\right )}{2 d} \\ & = \frac {\sinh ^2(c+d x) (b+a \tanh (c+d x))}{2 d}+\frac {\text {Subst}\left (\int \left (a+2 b x-\frac {a+4 b x}{1-x^2}\right ) \, dx,x,\tanh (c+d x)\right )}{2 d} \\ & = \frac {a \tanh (c+d x)}{2 d}+\frac {b \tanh ^2(c+d x)}{2 d}+\frac {\sinh ^2(c+d x) (b+a \tanh (c+d x))}{2 d}-\frac {\text {Subst}\left (\int \frac {a+4 b x}{1-x^2} \, dx,x,\tanh (c+d x)\right )}{2 d} \\ & = \frac {a \tanh (c+d x)}{2 d}+\frac {b \tanh ^2(c+d x)}{2 d}+\frac {\sinh ^2(c+d x) (b+a \tanh (c+d x))}{2 d}+\frac {(a-4 b) \text {Subst}\left (\int \frac {1}{-1-x} \, dx,x,\tanh (c+d x)\right )}{4 d}-\frac {(a+4 b) \text {Subst}\left (\int \frac {1}{1-x} \, dx,x,\tanh (c+d x)\right )}{4 d} \\ & = \frac {(a+4 b) \log (1-\tanh (c+d x))}{4 d}-\frac {(a-4 b) \log (1+\tanh (c+d x))}{4 d}+\frac {a \tanh (c+d x)}{2 d}+\frac {b \tanh ^2(c+d x)}{2 d}+\frac {\sinh ^2(c+d x) (b+a \tanh (c+d x))}{2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.11 (sec) , antiderivative size = 69, normalized size of antiderivative = 0.69 \[ \int \sinh ^2(c+d x) \left (a+b \tanh ^3(c+d x)\right ) \, dx=\frac {a (-c-d x)}{2 d}-\frac {b \left (4 \log (\cosh (c+d x))+\text {sech}^2(c+d x)-\sinh ^2(c+d x)\right )}{2 d}+\frac {a \sinh (2 (c+d x))}{4 d} \]

[In]

Integrate[Sinh[c + d*x]^2*(a + b*Tanh[c + d*x]^3),x]

[Out]

(a*(-c - d*x))/(2*d) - (b*(4*Log[Cosh[c + d*x]] + Sech[c + d*x]^2 - Sinh[c + d*x]^2))/(2*d) + (a*Sinh[2*(c + d
*x)])/(4*d)

Maple [A] (verified)

Time = 0.43 (sec) , antiderivative size = 68, normalized size of antiderivative = 0.68

method result size
derivativedivides \(\frac {a \left (\frac {\cosh \left (d x +c \right ) \sinh \left (d x +c \right )}{2}-\frac {d x}{2}-\frac {c}{2}\right )+b \left (\frac {\sinh \left (d x +c \right )^{4}}{2 \cosh \left (d x +c \right )^{2}}-2 \ln \left (\cosh \left (d x +c \right )\right )+\tanh \left (d x +c \right )^{2}\right )}{d}\) \(68\)
default \(\frac {a \left (\frac {\cosh \left (d x +c \right ) \sinh \left (d x +c \right )}{2}-\frac {d x}{2}-\frac {c}{2}\right )+b \left (\frac {\sinh \left (d x +c \right )^{4}}{2 \cosh \left (d x +c \right )^{2}}-2 \ln \left (\cosh \left (d x +c \right )\right )+\tanh \left (d x +c \right )^{2}\right )}{d}\) \(68\)
risch \(-\frac {a x}{2}+2 b x +\frac {{\mathrm e}^{2 d x +2 c} a}{8 d}+\frac {{\mathrm e}^{2 d x +2 c} b}{8 d}-\frac {{\mathrm e}^{-2 d x -2 c} a}{8 d}+\frac {{\mathrm e}^{-2 d x -2 c} b}{8 d}+\frac {4 b c}{d}-\frac {2 b \,{\mathrm e}^{2 d x +2 c}}{d \left ({\mathrm e}^{2 d x +2 c}+1\right )^{2}}-\frac {2 b \ln \left ({\mathrm e}^{2 d x +2 c}+1\right )}{d}\) \(123\)

[In]

int(sinh(d*x+c)^2*(a+b*tanh(d*x+c)^3),x,method=_RETURNVERBOSE)

[Out]

1/d*(a*(1/2*cosh(d*x+c)*sinh(d*x+c)-1/2*d*x-1/2*c)+b*(1/2*sinh(d*x+c)^4/cosh(d*x+c)^2-2*ln(cosh(d*x+c))+tanh(d
*x+c)^2))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 924 vs. \(2 (90) = 180\).

Time = 0.32 (sec) , antiderivative size = 924, normalized size of antiderivative = 9.24 \[ \int \sinh ^2(c+d x) \left (a+b \tanh ^3(c+d x)\right ) \, dx=\text {Too large to display} \]

[In]

integrate(sinh(d*x+c)^2*(a+b*tanh(d*x+c)^3),x, algorithm="fricas")

[Out]

1/8*((a + b)*cosh(d*x + c)^8 + 8*(a + b)*cosh(d*x + c)*sinh(d*x + c)^7 + (a + b)*sinh(d*x + c)^8 - 2*(2*(a - 4
*b)*d*x - a - b)*cosh(d*x + c)^6 - 2*(2*(a - 4*b)*d*x - 14*(a + b)*cosh(d*x + c)^2 - a - b)*sinh(d*x + c)^6 +
4*(14*(a + b)*cosh(d*x + c)^3 - 3*(2*(a - 4*b)*d*x - a - b)*cosh(d*x + c))*sinh(d*x + c)^5 - 2*(4*(a - 4*b)*d*
x + 7*b)*cosh(d*x + c)^4 + 2*(35*(a + b)*cosh(d*x + c)^4 - 4*(a - 4*b)*d*x - 15*(2*(a - 4*b)*d*x - a - b)*cosh
(d*x + c)^2 - 7*b)*sinh(d*x + c)^4 + 8*(7*(a + b)*cosh(d*x + c)^5 - 5*(2*(a - 4*b)*d*x - a - b)*cosh(d*x + c)^
3 - (4*(a - 4*b)*d*x + 7*b)*cosh(d*x + c))*sinh(d*x + c)^3 - 2*(2*(a - 4*b)*d*x + a - b)*cosh(d*x + c)^2 + 2*(
14*(a + b)*cosh(d*x + c)^6 - 15*(2*(a - 4*b)*d*x - a - b)*cosh(d*x + c)^4 - 2*(a - 4*b)*d*x - 6*(4*(a - 4*b)*d
*x + 7*b)*cosh(d*x + c)^2 - a + b)*sinh(d*x + c)^2 - 16*(b*cosh(d*x + c)^6 + 6*b*cosh(d*x + c)*sinh(d*x + c)^5
 + b*sinh(d*x + c)^6 + 2*b*cosh(d*x + c)^4 + (15*b*cosh(d*x + c)^2 + 2*b)*sinh(d*x + c)^4 + 4*(5*b*cosh(d*x +
c)^3 + 2*b*cosh(d*x + c))*sinh(d*x + c)^3 + b*cosh(d*x + c)^2 + (15*b*cosh(d*x + c)^4 + 12*b*cosh(d*x + c)^2 +
 b)*sinh(d*x + c)^2 + 2*(3*b*cosh(d*x + c)^5 + 4*b*cosh(d*x + c)^3 + b*cosh(d*x + c))*sinh(d*x + c))*log(2*cos
h(d*x + c)/(cosh(d*x + c) - sinh(d*x + c))) + 4*(2*(a + b)*cosh(d*x + c)^7 - 3*(2*(a - 4*b)*d*x - a - b)*cosh(
d*x + c)^5 - 2*(4*(a - 4*b)*d*x + 7*b)*cosh(d*x + c)^3 - (2*(a - 4*b)*d*x + a - b)*cosh(d*x + c))*sinh(d*x + c
) - a + b)/(d*cosh(d*x + c)^6 + 6*d*cosh(d*x + c)*sinh(d*x + c)^5 + d*sinh(d*x + c)^6 + 2*d*cosh(d*x + c)^4 +
(15*d*cosh(d*x + c)^2 + 2*d)*sinh(d*x + c)^4 + 4*(5*d*cosh(d*x + c)^3 + 2*d*cosh(d*x + c))*sinh(d*x + c)^3 + d
*cosh(d*x + c)^2 + (15*d*cosh(d*x + c)^4 + 12*d*cosh(d*x + c)^2 + d)*sinh(d*x + c)^2 + 2*(3*d*cosh(d*x + c)^5
+ 4*d*cosh(d*x + c)^3 + d*cosh(d*x + c))*sinh(d*x + c))

Sympy [F]

\[ \int \sinh ^2(c+d x) \left (a+b \tanh ^3(c+d x)\right ) \, dx=\int \left (a + b \tanh ^{3}{\left (c + d x \right )}\right ) \sinh ^{2}{\left (c + d x \right )}\, dx \]

[In]

integrate(sinh(d*x+c)**2*(a+b*tanh(d*x+c)**3),x)

[Out]

Integral((a + b*tanh(c + d*x)**3)*sinh(c + d*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.41 \[ \int \sinh ^2(c+d x) \left (a+b \tanh ^3(c+d x)\right ) \, dx=-\frac {1}{8} \, a {\left (4 \, x - \frac {e^{\left (2 \, d x + 2 \, c\right )}}{d} + \frac {e^{\left (-2 \, d x - 2 \, c\right )}}{d}\right )} - \frac {1}{8} \, b {\left (\frac {16 \, {\left (d x + c\right )}}{d} - \frac {e^{\left (-2 \, d x - 2 \, c\right )}}{d} + \frac {16 \, \log \left (e^{\left (-2 \, d x - 2 \, c\right )} + 1\right )}{d} - \frac {2 \, e^{\left (-2 \, d x - 2 \, c\right )} - 15 \, e^{\left (-4 \, d x - 4 \, c\right )} + 1}{d {\left (e^{\left (-2 \, d x - 2 \, c\right )} + 2 \, e^{\left (-4 \, d x - 4 \, c\right )} + e^{\left (-6 \, d x - 6 \, c\right )}\right )}}\right )} \]

[In]

integrate(sinh(d*x+c)^2*(a+b*tanh(d*x+c)^3),x, algorithm="maxima")

[Out]

-1/8*a*(4*x - e^(2*d*x + 2*c)/d + e^(-2*d*x - 2*c)/d) - 1/8*b*(16*(d*x + c)/d - e^(-2*d*x - 2*c)/d + 16*log(e^
(-2*d*x - 2*c) + 1)/d - (2*e^(-2*d*x - 2*c) - 15*e^(-4*d*x - 4*c) + 1)/(d*(e^(-2*d*x - 2*c) + 2*e^(-4*d*x - 4*
c) + e^(-6*d*x - 6*c))))

Giac [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 140, normalized size of antiderivative = 1.40 \[ \int \sinh ^2(c+d x) \left (a+b \tanh ^3(c+d x)\right ) \, dx=-\frac {4 \, {\left (d x + c\right )} {\left (a - 4 \, b\right )} - a e^{\left (2 \, d x + 2 \, c\right )} - b e^{\left (2 \, d x + 2 \, c\right )} - {\left (2 \, a e^{\left (2 \, d x + 2 \, c\right )} - 8 \, b e^{\left (2 \, d x + 2 \, c\right )} - a + b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + 16 \, b \log \left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right ) - \frac {8 \, {\left (3 \, b e^{\left (4 \, d x + 4 \, c\right )} + 4 \, b e^{\left (2 \, d x + 2 \, c\right )} + 3 \, b\right )}}{{\left (e^{\left (2 \, d x + 2 \, c\right )} + 1\right )}^{2}}}{8 \, d} \]

[In]

integrate(sinh(d*x+c)^2*(a+b*tanh(d*x+c)^3),x, algorithm="giac")

[Out]

-1/8*(4*(d*x + c)*(a - 4*b) - a*e^(2*d*x + 2*c) - b*e^(2*d*x + 2*c) - (2*a*e^(2*d*x + 2*c) - 8*b*e^(2*d*x + 2*
c) - a + b)*e^(-2*d*x - 2*c) + 16*b*log(e^(2*d*x + 2*c) + 1) - 8*(3*b*e^(4*d*x + 4*c) + 4*b*e^(2*d*x + 2*c) +
3*b)/(e^(2*d*x + 2*c) + 1)^2)/d

Mupad [B] (verification not implemented)

Time = 2.01 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.15 \[ \int \sinh ^2(c+d x) \left (a+b \tanh ^3(c+d x)\right ) \, dx=\frac {{\mathrm {e}}^{2\,c+2\,d\,x}\,\left (a+b\right )}{8\,d}-\frac {2\,b}{d\,\left ({\mathrm {e}}^{2\,c+2\,d\,x}+1\right )}-x\,\left (\frac {a}{2}-2\,b\right )+\frac {2\,b}{d\,\left (2\,{\mathrm {e}}^{2\,c+2\,d\,x}+{\mathrm {e}}^{4\,c+4\,d\,x}+1\right )}-\frac {{\mathrm {e}}^{-2\,c-2\,d\,x}\,\left (a-b\right )}{8\,d}-\frac {2\,b\,\ln \left ({\mathrm {e}}^{2\,c}\,{\mathrm {e}}^{2\,d\,x}+1\right )}{d} \]

[In]

int(sinh(c + d*x)^2*(a + b*tanh(c + d*x)^3),x)

[Out]

(exp(2*c + 2*d*x)*(a + b))/(8*d) - (2*b)/(d*(exp(2*c + 2*d*x) + 1)) - x*(a/2 - 2*b) + (2*b)/(d*(2*exp(2*c + 2*
d*x) + exp(4*c + 4*d*x) + 1)) - (exp(- 2*c - 2*d*x)*(a - b))/(8*d) - (2*b*log(exp(2*c)*exp(2*d*x) + 1))/d